package top.idcard.agent.biz.entity;

import com.alibaba.fastjson.JSON;

/**
 * @author wx
 * @version 1.0
 * @date 2021/1/29 5:28 下午
 * 外国人居留证实体类
 */
public class AlienResidentCertificate extends Certification{
    //英文名  120
    private String englishName;
    //性别  2
    private Short sex;
    //永久居留证号码  30
    private String no;
    //国籍/地区
    private String nation;
    //中文名  30
    private String chineseName;
    //证件签发日期  16
    private String validationStart;
    //证件结束日期  16
    private String validationEnd;
    //出生日期  16
    private String birthday;
    //证件版本号  4
    private Integer version;
    //受理机关代码  8
    private String handleOrganization;
    //证件类别  “I”
    private String type;
    //头像  38862
    private byte[] img;

    public String getEnglishName() {
        return englishName;
    }

    public void setEnglishName(String englishName) {
        this.englishName = englishName;
    }

    public Short getSex() {
        return sex;
    }

    public void setSex(Short sex) {
        this.sex = sex;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getNation() {
        return nation;
    }

    public void setNation(String nation) {
        this.nation = nation;
    }

    public String getChineseName() {
        return chineseName;
    }

    public void setChineseName(String chineseName) {
        this.chineseName = chineseName;
    }

    public String getValidationStart() {
        return validationStart;
    }

    public void setValidationStart(String validationStart) {
        this.validationStart = validationStart;
    }

    public String getValidationEnd() {
        return validationEnd;
    }

    public void setValidationEnd(String validationEnd) {
        this.validationEnd = validationEnd;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getHandleOrganization() {
        return handleOrganization;
    }

    public void setHandleOrganization(String handleOrganization) {
        this.handleOrganization = handleOrganization;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public byte[] getImg() {
        return img;
    }

    public void setImg(byte[] img) {
        this.img = img;
    }

    @Override
    public CertificationEnum certificationType() {
        return CertificationEnum.Foreign;
    }

    @Override
    public byte[] getBytes() {
        return new byte[0];
    }

    @Override
    public AlienResidentCertificate parseFrom(byte[] bytes){
        String str = new String(bytes);
        return JSON.parseObject(str, AlienResidentCertificate.class);
    }
}
